﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<script type="text/javascript" src="~/Areas/SystemManage/Content/webuploader/uploader.js"></script>
<script type="text/javascript" src="~/Areas/SystemManage/Content/webuploader/webuploader.min.js"></script>

<script type="text/javascript" src="~/Areas/SystemManage/Content/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="~/Areas/SystemManage/Content/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="~/Areas/SystemManage/Content/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        $(".upload-img").InitUploader({
                multiple: true,
                thumbnail: true,
                filesize: "10240",
                sendurl: "/SystemManage/Base/upload?type=1", // 文件接收服务端。
                filetypes: "gif,jpg,png,bmp"
            });

        initEditor();
        initControl();
        if (!!keyValue) {
            $.ajax({
                url: "/SystemManage/Offer/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
    });
    function initEditor()
    {
        UE.getEditor('INTRO', {
            initialFrameWidth: "100%", //初始化选项
            initialFrameHeight: 250,//设置编辑器高度
            autoHeightEnabled: false,
            pasteplain: false,
            wordCount: false,
            elementPathEnabled: false
        })
    }
    function initControl() {
        $("#STATE").bindSelect();

        //获取分类
        $("#PCID").bindSelect({
            url: "/SystemManage/Offer/GetTreeSelectJson",
            id: "PCID",
            text: "NAME"
        });
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/SystemManage/User/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>
<form id="form1">
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#">基本信息</a></li>
            @*<li ><a href="#">扩展信息</a></li>*@
        </ul>
        <div style="padding-top: 20px; margin-right: 30px;">
            <table class="form">
                <tr>
                    <th class="formTitle">商品标题</th>
                    <td class="formValue">
                        <input id="TITLE" name="TITLE" type="text" class="form-control required" placeholder="请输入商品标题" />
                    </td>
                    <th class="formTitle">商品规则(比如500g,1L)</th>
                    <td class="formValue">
                        <input id="SPECIFICATIONSSTR" name="SPECIFICATIONSSTR" class="form-control required" placeholder="请输入商品规则" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">商品Vip价格</th>
                    <td class="formValue">
                        <input id="VIPPRICE" name="VIPPRICE" class="form-control required" placeholder="请输入商品Vip价格" />
                    </td>
                    <th class="formTitle">商品市场价格</th>
                    <td class="formValue">
                        <input id="MARKETPRICE" name="MARKETPRICE" class="form-control required" placeholder="请输入市场价格" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">商品分类</th>
                    <td class="formValue">
                        <select id="PCID" name="PCID" class="form-control required">
                            <option value="">==请选择==</option>
                        </select>
                    </td>
                    <th class="formTitle">商品状态</th>
                    <td class="formValue">
                        <select id="STATE" name="STATE" class="form-control required">
                            <option value="1">已上架</option>
                            <option value="0">未上架</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">排序(数字越大越靠前)</th>
                    <td class="formValue">
                        <input id="SORT" name="SORT" type="text" class="form-control required" placeholder="请输入排序(数字越大越靠前)" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" valign="top">
                            备注
                    </th>
                    <td class="formValue" colspan="3">
                        <input id="MEMO" name="MEMO" type="text" class="form-control required" placeholder="请输入排序(数字越大越靠前)" />
                    </td>
               </tr>
                <tr>
                    <th class="formTitle">商品图集</th>
                    <td class="formValue" colspan="3">

                        <div id="fileList" class="photo-list">
                            <ul id="img_ul" class="clearfix"></ul>
                        </div>
                        <div class="upload-box upload-img"></div>

                    </td>
                </tr>
                <tr>
                    <th class="formTitle" valign="top">
                        商品介绍
                    </th>
                    <td class="formValue" colspan="3">
                        <script id="INTRO" type="text/plain" style="width:1024px;height:500px;"></script>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
